<script>
	import indexConfig from '@/config/index.config';
	
	export default {
		onLaunch: function(options) {
			console.log('App Launch',options)
		},
		onShow: function(options) {
			console.log('App Show',options)
			//alert(uni.getStorageSync('openid'));
			// 微信公证号openid
			//  #ifdef H5
			if (/(MicroMessenger)/i.test(navigator.userAgent)) {
				let _codeMatch = window.location.href.match(/code=(\S*)&state/)
				//alert(_codeMatch);
				if (_codeMatch && _codeMatch.length > 1) {
					this.$mStore.commit('getWxOpenid', {
						code: _codeMatch[1],
					})
				} else if (!uni.getStorageSync('openid')) {
					let href = `https://open.weixin.qq.com/connect/oauth2/authorize?appid=${indexConfig.appid}&redirect_uri=${encodeURIComponent(window.location.href)}&response_type=code&scope=snsapi_base&state=wxopenid#wechat_redirect`
					window.location.href = href
				}
			}
			// #endif
			
			if (uni.getStorageSync('location')) {
				this.$mStore.dispatch('locationChange', uni.getStorageSync('location'));
			}
		},
		onHide: function() {
			console.log('App Hide')
		}
	}
</script>

<style lang="scss">
	/*每个页面公共css */
	@import '@/uni_modules/uni-scss/index.scss';
	/* #ifndef APP-NVUE */
	@import '@/static/customicons.css';
	// 设置整个项目的背景色
	@import '@/static/iconfont/iconfont.css';

	page {
		background-color: #f5f5f5;
	}
	.page-box{
		min-height: calc(100vh - 88rpx);
		background-color: #0F0E0C;
	}
	/* #endif */
	.null-box {
		width: 710rpx;
		height: 710rpx;
		display: flex;
		align-items: center;
		justify-content: center;
		flex-direction: column;
		font-size: 24rpx;
		color: #ccc;
		image {
			width: 348rpx;
			height: 348rpx;
			background: none !important;
		}
	}

	.example-info {
		font-size: 14px;
		color: #333;
		padding: 10px;
	}

	image {}

	.flex_sw {
		display: flex !important;
		align-items: center !important;
		justify-content: space-between !important;
	}

	.flex {
		display: flex !important;
		align-items: center !important;
	}

	.flex_center {
		display: flex !important;
		align-items: center !important;
		justify-content: center !important;
	}

	.arrow {
		&::after {
			display: block;
			content: "";
			width: 14rpx;
			height: 26rpx;
			background: url(./static/grey-arrow-right.png) no-repeat;
			background-size: 100% auto;
			margin-left: 10rpx;
		}
	}

	b,
	i,
	span,
	em {
		font-weight: 400;
	}
	
	.status-bar{height: var(--status-bar-height);}
	.status-bar_fixed{ width: 100%; height: var(--status-bar-height); background-color: #f5f5f5;  position: fixed; left: 0; top: 0; z-index: 2; }
	.status-bar_fixedh{ width: 100%; height: var(--status-bar-height);}
</style>

<style>
	@import '@/static/css/common.css';
</style>
